import system from "@/utils/request";
import { AxiosPromise } from "axios";
import { reportInfo, resultInfo ,reportResourceInfo} from "./type";
const { systemService,resourceService } = system;

/**
 * 管理员获取列表
 *
 */
export function getReportList(data: reportInfo): AxiosPromise<any> {
  return systemService({
    url: "/system/userReport/getList",
    method: "post",
    data: data,
  });
}


/**
 * 管理员获取内容举报列表
 *
 */
export function getResourceReportList(data: reportResourceInfo): AxiosPromise<any> {
  return resourceService({
    url: "/resource/report/getList",
    method: "post",
    data: data,
  });
}



/**
 * 管理员审核举报
 */
export function examine(result: resultInfo): AxiosPromise<any> {
  return systemService({
    url: "/system/userReport/manage",
    method: "patch",
    data: result,
  });
}


/**
 * 管理员审核-内容举报
 */
export function examineResource(result: resultInfo): AxiosPromise<any> {
  return systemService({
    url: "/resource/report/manage",
    method: "patch",
    data: result,
  });
}

/**
 *
 * @param id 删除举报
 * @returns
 */

export function deleteReport(id: number): AxiosPromise<any> {
  return systemService({
    url: "/system/userReport/delete/" + id,
    method: "delete",
  });
}

export function deleteReportList(ids: number[]): AxiosPromise<any> {
  return systemService({
    url: "/system/userReport/deleteMore/" + ids.join(","),
    method: "delete",
  });
}


/**
 * 管理员获取内容类型
 *
 */
export function getResourceType(): AxiosPromise<any> {
  return resourceService({
    url: "/resource/report/categories",
    method: "get",
  });
}


/**
 * 管理员获取举报结果
 *
 */
export function getResult(): AxiosPromise<any> {
  return resourceService({
    url: "/resource/report/results",
    method: "get",
  });
}

/**
 *
 * @param id 内容举报删除
 * @returns
 */

export function deleteResourceReport(id: number): AxiosPromise<any> {
  return resourceService({
    url: "/system/userReport/delete/" + id,
    method: "delete",
  });
}

export function deleteResourceReportList(ids: number[]): AxiosPromise<any> {
  return resourceService({
    url: "/resource/report/deleteMore",
    method: "delete",
		data:ids
  });
}
